package twelve;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class Student implements Serializable {
	private int id;
	private String name;
	private int age;
	private String department;
	public Student(int id, String name, int age ,String department) {
		this.id =id;
		this.name = name;
		this.age = age;
		this.department = department;
	}
	public static void main(String args[]) {
		Student stu = new Student (981036,"Li Ming ", 16,"CSD");
		try {
			FileOutputStream fo = new FileOutputStream("data.ser");
			ObjectOutputStream so = new ObjectOutputStream(fo);
			so.writeObject(stu);
			so.close();
		}catch(Exception e) {
			System.out.println(e);
		}
	}
}
